﻿
Partial Class AdminNewOnlineOrders
    Inherits Page

    Public Total As Integer
    Public Orders As List(Of orders)

    Protected Overrides Sub OnLoad(e As EventArgs)

        Dim today = Now.AddHours(3)
        Dim past = today.AddHours(-6)

        Using context As New TaxiEntities()
            Total = context.orders.Count(CType(Function(a) past <= a.order_create And a.order_create <= today, Func(Of orders, Boolean)))
            Orders = context.orders.Include("torders").Include("torders.taxist").Include("torders.taxist.cities").Where(CType(Function(a) past <= a.order_create And a.order_create <= today, Func(Of orders, Boolean))).OrderByDescending(Function(a) a.order_create).ToList()
        End Using
    End Sub

End Class
